const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = {
  mode: 'development',
  entry: {
    index:"./src/index.js",
    //particles+app 实现界面的星形状效果
    particles:"./javascripts/particles.min.js",
    app:"./javascripts/app.js",
    purejs:"./javascripts/purejs.js",
    chat:'./javascripts/chat.js',
    jquery:'./javascripts/jquery.js',
    getLatInf:'./javascripts/getLatInf.js',
    forecast:'./javascripts/forecast.js',
    node_RSA:'./javascripts/node_RSA.js'
  },
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "[name].js",

  },
  module:{
    rules:[
      // {
      //   test: /\.html$/,
      //   loader: 'html-withimg-loader'
      // },
    {
      test:/\.css$/,
      use:['style-loader','css-loader'],
    },
      {
        test: /\.(gif|jpg|png)$/,
        loader: 'url-loader',
        options:{
                esModule: false,
        }
      }
  ],

},
  plugins: [
    new CopyWebpackPlugin([{ from: "./src/index.html", to: "index.html" }]),
    //  add html!!!
    new CopyWebpackPlugin([{ from: "./src/register.html", to: "register.html" }]),
    new CopyWebpackPlugin([{ from: "./src/chat.html", to: "chat.html" }]),
  ],
  devServer: { contentBase: path.join(__dirname, "dist"), compress: true },

  // resolve:{
  //   extensions:['js', 'jsx'],
  //   alias:{
  //     components:path.join(__dirname, 'javascripts'),
  //     font:path.join(__dirname,'font')
  //   }
  // }

  node:{
    fs:'empty',
    dns:'empty',
  },
};
